SimpleControls.cs (9828B)
1 // GENERATED AUTOMATICALLY FROM 'Assets/Samples/Input System/1.0.0-preview.6/Simple Demo/SimpleControls.inputactions' 2 3 using System; 4 using System.Collections; 5 using System.Collections.Generic; 6 using UnityEngine.InputSystem; 7 using UnityEngine.InputSystem.Utilities; 8 9 public class @SimpleControls : IInputActionCollection, IDisposable 10 { 11 public InputActionAsset asset { get; } 12 public @SimpleControls() 13 { 14 asset = InputActionAsset.FromJson(@"{ 15 ""name"": ""SimpleControls"", 16 ""maps"": [ 17 { 18 ""name"": ""gameplay"", 19 ""id"": ""265c38f5-dd18-4d34-b198-aec58e1627ff"", 20 ""actions"": [ 21 { 22 ""name"": ""fire"", 23 ""type"": ""Button"", 24 ""id"": ""1077f913-a9f9-41b1-acb3-b9ee0adbc744"", 25 ""expectedControlType"": ""Button"", 26 ""processors"": """", 27 ""interactions"": ""Tap,SlowTap"" 28 }, 29 { 30 ""name"": ""move"", 31 ""type"": ""Value"", 32 ""id"": ""50fd2809-3aa3-4a90-988e-1facf6773553"", 33 ""expectedControlType"": ""Vector2"", 34 ""processors"": """", 35 ""interactions"": """" 36 }, 37 { 38 ""name"": ""look"", 39 ""type"": ""Value"", 40 ""id"": ""c60e0974-d140-4597-a40e-9862193067e9"", 41 ""expectedControlType"": ""Vector2"", 42 ""processors"": """", 43 ""interactions"": """" 44 } 45 ], 46 ""bindings"": [ 47 { 48 ""name"": """", 49 ""id"": ""abb776f3-f329-4f7b-bbf8-b577d13be018"", 50 ""path"": ""*/{PrimaryAction}"", 51 ""interactions"": """", 52 ""processors"": """", 53 ""groups"": """", 54 ""action"": ""fire"", 55 ""isComposite"": false, 56 ""isPartOfComposite"": false 57 }, 58 { 59 ""name"": """", 60 ""id"": ""e1b8c4dd-7b3a-4db6-a93a-0889b59b1afc"", 61 ""path"": ""<Gamepad>/leftStick"", 62 ""interactions"": """", 63 ""processors"": """", 64 ""groups"": """", 65 ""action"": ""move"", 66 ""isComposite"": false, 67 ""isPartOfComposite"": false 68 }, 69 { 70 ""name"": ""Dpad"", 71 ""id"": ""cefc16fc-557a-44b0-939f-2ad792876b07"", 72 ""path"": ""Dpad"", 73 ""interactions"": """", 74 ""processors"": """", 75 ""groups"": """", 76 ""action"": ""move"", 77 ""isComposite"": true, 78 ""isPartOfComposite"": false 79 }, 80 { 81 ""name"": ""up"", 82 ""id"": ""07244659-79df-461d-b329-defbe2fbc5f6"", 83 ""path"": ""<Keyboard>/w"", 84 ""interactions"": """", 85 ""processors"": """", 86 ""groups"": """", 87 ""action"": ""move"", 88 ""isComposite"": false, 89 ""isPartOfComposite"": true 90 }, 91 { 92 ""name"": ""down"", 93 ""id"": ""f0ec75cb-f02c-40d2-a33f-1fd6eab2ae0b"", 94 ""path"": ""<Keyboard>/s"", 95 ""interactions"": """", 96 ""processors"": """", 97 ""groups"": """", 98 ""action"": ""move"", 99 ""isComposite"": false, 100 ""isPartOfComposite"": true 101 }, 102 { 103 ""name"": ""left"", 104 ""id"": ""21fe6bfe-4721-4483-9f4a-a0031ade105c"", 105 ""path"": ""<Keyboard>/a"", 106 ""interactions"": """", 107 ""processors"": """", 108 ""groups"": """", 109 ""action"": ""move"", 110 ""isComposite"": false, 111 ""isPartOfComposite"": true 112 }, 113 { 114 ""name"": ""right"", 115 ""id"": ""2dd39746-c75c-4a11-838a-e59eacaf4e0b"", 116 ""path"": ""<Keyboard>/d"", 117 ""interactions"": """", 118 ""processors"": """", 119 ""groups"": """", 120 ""action"": ""move"", 121 ""isComposite"": false, 122 ""isPartOfComposite"": true 123 }, 124 { 125 ""name"": """", 126 ""id"": ""c106d6e6-2780-47ff-b318-396171bd54cc"", 127 ""path"": ""<Gamepad>/rightStick"", 128 ""interactions"": """", 129 ""processors"": """", 130 ""groups"": """", 131 ""action"": ""look"", 132 ""isComposite"": false, 133 ""isPartOfComposite"": false 134 }, 135 { 136 ""name"": """", 137 ""id"": ""578caa03-6827-4797-adfc-a59770c437fe"", 138 ""path"": ""<Pointer>/delta"", 139 ""interactions"": """", 140 ""processors"": ""ScaleVector2(x=2,y=2)"", 141 ""groups"": """", 142 ""action"": ""look"", 143 ""isComposite"": false, 144 ""isPartOfComposite"": false 145 } 146 ] 147 } 148 ], 149 ""controlSchemes"": [] 150 }"); 151 // gameplay 152 m_gameplay = asset.FindActionMap("gameplay", throwIfNotFound: true); 153 m_gameplay_fire = m_gameplay.FindAction("fire", throwIfNotFound: true); 154 m_gameplay_move = m_gameplay.FindAction("move", throwIfNotFound: true); 155 m_gameplay_look = m_gameplay.FindAction("look", throwIfNotFound: true); 156 } 157 158 public void Dispose() 159 { 160 UnityEngine.Object.Destroy(asset); 161 } 162 163 public InputBinding? bindingMask 164 { 165 get => asset.bindingMask; 166 set => asset.bindingMask = value; 167 } 168 169 public ReadOnlyArray<InputDevice>? devices 170 { 171 get => asset.devices; 172 set => asset.devices = value; 173 } 174 175 public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes; 176 177 public bool Contains(InputAction action) 178 { 179 return asset.Contains(action); 180 } 181 182 public IEnumerator<InputAction> GetEnumerator() 183 { 184 return asset.GetEnumerator(); 185 } 186 187 IEnumerator IEnumerable.GetEnumerator() 188 { 189 return GetEnumerator(); 190 } 191 192 public void Enable() 193 { 194 asset.Enable(); 195 } 196 197 public void Disable() 198 { 199 asset.Disable(); 200 } 201 202 // gameplay 203 private readonly InputActionMap m_gameplay; 204 private IGameplayActions m_GameplayActionsCallbackInterface; 205 private readonly InputAction m_gameplay_fire; 206 private readonly InputAction m_gameplay_move; 207 private readonly InputAction m_gameplay_look; 208 public struct GameplayActions 209 { 210 private @SimpleControls m_Wrapper; 211 public GameplayActions(@SimpleControls wrapper) { m_Wrapper = wrapper; } 212 public InputAction @fire => m_Wrapper.m_gameplay_fire; 213 public InputAction @move => m_Wrapper.m_gameplay_move; 214 public InputAction @look => m_Wrapper.m_gameplay_look; 215 public InputActionMap Get() { return m_Wrapper.m_gameplay; } 216 public void Enable() { Get().Enable(); } 217 public void Disable() { Get().Disable(); } 218 public bool enabled => Get().enabled; 219 public static implicit operator InputActionMap(GameplayActions set) { return set.Get(); } 220 public void SetCallbacks(IGameplayActions instance) 221 { 222 if (m_Wrapper.m_GameplayActionsCallbackInterface != null) 223 { 224 @fire.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnFire; 225 @fire.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnFire; 226 @fire.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnFire; 227 @move.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnMove; 228 @move.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnMove; 229 @move.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnMove; 230 @look.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnLook; 231 @look.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnLook; 232 @look.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnLook; 233 } 234 m_Wrapper.m_GameplayActionsCallbackInterface = instance; 235 if (instance != null) 236 { 237 @fire.started += instance.OnFire; 238 @fire.performed += instance.OnFire; 239 @fire.canceled += instance.OnFire; 240 @move.started += instance.OnMove; 241 @move.performed += instance.OnMove; 242 @move.canceled += instance.OnMove; 243 @look.started += instance.OnLook; 244 @look.performed += instance.OnLook; 245 @look.canceled += instance.OnLook; 246 } 247 } 248 } 249 public GameplayActions @gameplay => new GameplayActions(this); 250 public interface IGameplayActions 251 { 252 void OnFire(InputAction.CallbackContext context); 253 void OnMove(InputAction.CallbackContext context); 254 void OnLook(InputAction.CallbackContext context); 255 } 256 }